package com.han.methodlog.service.impl;

import com.han.methodlog.service.AsyncEmailService;
import com.han.methodlog.service.MailService;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;


@Service
public class AsyncEmailServiceImpl implements AsyncEmailService {

    private final MailService mailService;

    public AsyncEmailServiceImpl(MailService mailService) {
        this.mailService = mailService;
    }

    @Async
    @Override
    public void sendEmailAsync(String subject, String content) {
        try {
            mailService.sendMail(subject, content);
        } catch (Exception e) {
            // 发送邮件发生了异常，进入重试队列

        }
    }
}
